Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combines modifiers not allowed with type, and combinations.This also simplifies logic. Adds more detail to explanation #2807

Merged
merged 7 commits into from Jun 29, 2017

Conversation

johnregan
Copy link

No description provided.

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

@johnregan johnregan changed the title Combines errors and simplifies logic. Adds more detail to explanation Combines modifiers not allowed with type, and combinations.This also simplifies logic. Adds more detail to explanation Jun 24, 2017
Copy link
Contributor

@felixmulder felixmulder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor nitpicks otherwise LGTM

}
}

private def getPrintableTypeFromFlagSet(flag: FlagSet) =
Map(Trait -> "trait", Method -> "method", Mutable -> "variable").get(flag)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this method is only used by addFlag, I would nest it in the method like:

def addFlag(mods: Modifiers, flag: FlagSet): Modifiers = {
  def getPrintableTypeFromFlagSet(flag: FlagSet) =
    Map(Trait -> "trait", Method -> "method", Mutable -> "variable").get(flag)

  if (compatible(mods.flags, flag)) mods | flag
  else {
    syntaxError(ModifiersNotAllowed(mods.flags, getPrintableTypeFromFlagSet(flag)))
    Modifiers(flag)
  }
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely

| `lazy' values
| AccessModifier ::= (`private' | `protected') [AccessQualifier] methods, classes
| AccessQualifier ::= `[' (id | `this') `]'
|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a copy of the syntax here might be nice, but it'd be better if we could link to the spec (we could open an issue for this instead).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense rather than duplicating maintenance effort

@johnregan
Copy link
Author

@felixmulder can someone press merge 😄

@felixmulder felixmulder merged commit 425c8c1 into scala:master Jun 29, 2017
@felixmulder
Copy link
Contributor

Of course, thanks! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants